package com.ete.service.manager.location

import android.annotation.SuppressLint
import com.ete.service.entry.location.LocationEntry
import com.ete.service.entry.location.LocationResult
import com.ete.service.service.location.LocationUtil

/**
 * Author:LiXian
 * <p>
 * Desc:定位
 * Version:1.0
 * date 2025/4/7 16:15
 */
@SuppressLint("MissingPermission")
object LocationManager {

    const val TAG = "LocationManager"
    const val TAG_ANDROID_API = "LocationManager_Android_Api"
    const val TAG_SERIAL = "LocationManager_Serial"

    /**
     * 初始化定位
     */
    @JvmStatic
    @JvmOverloads
    fun initLocation(mEntry: LocationEntry = LocationEntry()) {
        LocationUtil.initLocation(mEntry)
    }

    /**
     * 开始定位
     */
    @JvmStatic
    fun startLocation(): Int {
        return LocationUtil.startLocation()
    }

    /**
     * 检查权限
     */
    @JvmStatic
    @JvmOverloads
    fun checkedPermission(mCallback:(Int) -> Unit = {}) {
        LocationUtil.checkedPermission(mCallback)
    }

    /**
     * 停止定位
     */
    @JvmStatic
    fun stopLocation() {
        LocationUtil.stopLocation()
    }

    /**
     * 销毁定位
     */
    @JvmStatic
    fun destroyLocation() {
        LocationUtil.destroyLocation()
    }

    /**
     * 跳转打开GSP定位
     */
    @JvmStatic
    fun navigationOpenGps() {
        LocationUtil.navigationOpenGps()
    }

    /**
     * 错误
     */
    @JvmStatic
    fun getErrorByCode(code: Int): String {
        return LocationUtil.getErrorByCode(code)
    }

    /**
     * 获取定位结果
     */
    @JvmStatic
    fun getLocationResult(): LocationResult {
        return LocationUtil.getLocationResult()
    }

    /**
     * 是否串口（GPS）定位
     */
    @JvmStatic
    fun isSerialLocation(): Boolean {
        return LocationUtil.isSerialLocation()
    }

    /**
     * 是否正在定位
     */
    @JvmStatic
    fun isLocationning(): Boolean {
        return LocationUtil.isLocationning()
    }

    /**
     * 是否有GPS模块定位
     */
    @JvmStatic
    fun isGpsModel(): Boolean {
        return LocationUtil.isGpsModel()
    }
}